:: Author by AngryPowman

@echo off

:: paths
set cpp_output=..\src\venus_net\protocol
set cs_output=..\src\zeus_mud\zeus_mud_wpf_client\protocol\%%~ni.cs

:: generate process
echo generating c++ source files :
for /f "delims=" %%i in ('dir /b/a "*.proto"') do (
	.\tools\protoc.exe -I=. --cpp_out=%cpp_output% %%i
	echo 	generated '%%i'
)

echo generating csharp source files :
for /f "delims=" %%i in ('dir /b/a "*.proto"') do (
	.\tools\ProtoGen_Net\protogen.exe -i:%%i -o:%cs_output%
	echo 	generated '%%i'
)

:: generate c++ header
echo generating protobuf.h for c++ :
set header_path=%cpp_output%\..\protobuf.h
echo // Generated by Zeus, DO NOT EDIT! > %header_path%
echo // DateTime : %date:~0% %time:~0,-3%  >> %header_path%
echo.>>%header_path%
echo #ifndef __PROTOBUF_H__ >> %header_path%
echo #define __PROTOBUF_H__ >> %header_path%
:: echo #pragma warning(disable : 4996) >> %header_path%
echo.>>%header_path%

for /f "delims=" %%i in ('dir /b/a "%cpp_output%\*.pb.h"') do (
	echo #include "protocol/%%i" >> %header_path%
)

echo.>> %header_path%
echo #endif >> %header_path%